Repository navigation
Make QuantAbsorption's input-side absorption opt-in (#24780) - #24780
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/24780
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 4201e88 with merge base ebdb936 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@mcremon-meta has exported this pull request. If you are a Meta employee, you can view the originating Diff in D130466673. |
This PR needs a
|
Summary: This should have been part of #24720, which added `QuantAbsorptionPass` with the other fused_quant graph passes. It was left out of that PR by mistake. By default, `QuantAbsorptionPass` now only runs the rewrite that is never less accurate. The docstring explains why the other two modes are opt-in. - Output side (unchanged, always on): the producer writes its output directly in the downstream quantize's qparams. The value still ends up on that grid, rounded once instead of twice, so each element is at least as close to the float result. It isn't bit-exact with the q/dq graph, though. - Input side (now opt-in, `absorb_into_inputs`): the consumer reads values on the dequantize's grid instead of the quantize's. Dropping the second rounding is more accurate on average, but not for every value. - Forked dequantize (already opt-in, `absorb_with_fork`): its float users see values on the quantize's grid instead of the producer's, which can be coarser. Only the docstring changes. With input-side absorption off, a pair that only the input side would remove is left to `ReplaceDequantQuantWithRequantize`, which turns it into a `fused_quant.requantize`. Differential Revision: D130466673
Summary: This should have been part of #24720, which added `QuantAbsorptionPass` with the other fused_quant graph passes. It was left out of that PR by mistake. By default, `QuantAbsorptionPass` now only runs the rewrite that is never less accurate. The docstring explains why the other two modes are opt-in. - Output side (unchanged, always on): the producer writes its output directly in the downstream quantize's qparams. The value still ends up on that grid, rounded once instead of twice, so each element is at least as close to the float result. It isn't bit-exact with the q/dq graph, though. - Input side (now opt-in, `absorb_into_inputs`): the consumer reads values on the dequantize's grid instead of the quantize's. Dropping the second rounding is more accurate on average, but not for every value. - Forked dequantize (already opt-in, `absorb_with_fork`): its float users see values on the quantize's grid instead of the producer's, which can be coarser. Only the docstring changes. With input-side absorption off, a pair that only the input side would remove is left to `ReplaceDequantQuantWithRequantize`, which turns it into a `fused_quant.requantize`. Reviewed By: DrJessop Differential Revision: D130466673
8647e29 to
f49919e
Compare
Summary: This should have been part of #24720, which added `QuantAbsorptionPass` with the other fused_quant graph passes. It was left out of that PR by mistake. By default, `QuantAbsorptionPass` now only runs the rewrite that is never less accurate. The docstring explains why the other two modes are opt-in. - Output side (unchanged, always on): the producer writes its output directly in the downstream quantize's qparams. The value still ends up on that grid, rounded once instead of twice, so each element is at least as close to the float result. It isn't bit-exact with the q/dq graph, though. - Input side (now opt-in, `absorb_into_inputs`): the consumer reads values on the dequantize's grid instead of the quantize's. Dropping the second rounding is more accurate on average, but not for every value. - Forked dequantize (already opt-in, `absorb_with_fork`): its float users see values on the quantize's grid instead of the producer's, which can be coarser. Only the docstring changes. With input-side absorption off, a pair that only the input side would remove is left to `ReplaceDequantQuantWithRequantize`, which turns it into a `fused_quant.requantize`. Reviewed By: DrJessop Differential Revision: D130466673
f49919e to
4201e88
Compare
Summary:
This should have been part of
#24720, which added
QuantAbsorptionPasswith the other fused_quant graph passes. It was left outof that PR by mistake.
By default,
QuantAbsorptionPassnow only runs the rewrite that is never lessaccurate. The docstring explains why the other two modes are opt-in.
in the downstream quantize's qparams. The value still ends up on that grid,
rounded once instead of twice, so each element is at least as close to the
float result. It isn't bit-exact with the q/dq graph, though.
absorb_into_inputs): the consumer reads values onthe dequantize's grid instead of the quantize's. Dropping the second rounding
is more accurate on average, but not for every value.
absorb_with_fork): its float users seevalues on the quantize's grid instead of the producer's, which can be
coarser. Only the docstring changes.
With input-side absorption off, a pair that only the input side would remove
is left to
ReplaceDequantQuantWithRequantize, which turns it into afused_quant.requantize.Reviewed By: DrJessop
Differential Revision: D130466673